import React from 'react'
import { Switch, Redirect } from 'react-router-dom'
import LoadableComponent from '../../utils/LoadableComponent'
import PrivateRoute from '../PrivateRoute'

const Home = LoadableComponent(()=>import('../../routes/Home/index'))  //参数一定要是函数，否则不会懒加载，只会代码拆分
//办理入住手续
const Checkin = LoadableComponent(()=>import('../../routes/Check/Checkin/index')) //办理入住
const Checkout = LoadableComponent(()=>import('../../routes/Check/Checkout/index')) //办理退房
const Reserve = LoadableComponent(()=>import('../../routes/Check/Reserve/index')) //预定信息
//房间管理
const RoomManager = LoadableComponent(()=>import('../../routes/RoomManager/index'))
// //人员管理
const Employee = LoadableComponent(()=>import('../../routes/Employee/index'))
//订单记录
const CheckinRecord = LoadableComponent(()=>import('../../routes/CheckinRecord/index'))//订单记录
// //会员记录
// const Viprecord = LoadableComponent(()=>import('../../routes/Viprecord/index'))
// //系统管理
const Authority = LoadableComponent(()=>import('../../routes/SystemSetting/Authority/index'))//权限管理
const Roles = LoadableComponent(()=>import('../../routes/SystemSetting/Roles/index'))//角色管理
const RoleTo = LoadableComponent(()=>import('../../routes/SystemSetting/RoleTo/index'))//角色分配



// @withRouter
class ContentMain extends React.Component {
  render () {

    console.info("this.props.match===",this.props);
    // TODO菜单名称
    return (
      <div>
        <div style={{padding: 16, position: 'relative'}}>
          <Switch>
            <PrivateRoute exact path='/home' component={Home}/>
             {/*办理入住 */}
            <PrivateRoute exact path='/Check/Checkin' component={Checkin}/>
            {/* 办理退房 */}
            <PrivateRoute exact path='/Check/Checkout' component={Checkout}/>
            {/* 预定信息 */}
            <PrivateRoute exact path='/Check/Reserve' component={Reserve}/>
            {/* 房间管理 */}
            <PrivateRoute exact path='/RoomManager' component={RoomManager}/>
            {/* 人员管理 */}
            <PrivateRoute exact path='/Employee' component={Employee}/>
            {/*订单记录*/}
            <PrivateRoute exact path='/CheckinRecord' component={CheckinRecord}/>
            {/*/!* 会员记录 *!/*/}
            {/*<PrivateRoute exact path='/Viprecord' component={Viprecord}/>*/}
            {/*/!* 权限管理 *!/*/}
            <PrivateRoute exact path='/SystemSetting/Authority' component={Authority}/>
            {/*/!* 角色管理 *!/*/}
            <PrivateRoute exact path='/SystemSetting/Roles' component={Roles}/>
            {/*/!* 角色分配 *!/*/}
            <PrivateRoute exact path='/SystemSetting/RoleTo' component={RoleTo}/>


            <Redirect exact from='/' to='/home'/>
          </Switch>
        </div>
      </div>
    )
  }
}

export default ContentMain
